///////////////////////////////////////////////////////////////////////////////
// File Name:   vga_ctrl.v
//
// Author:      Cody Cziesler
//
// Description: The top-level control block for the vga
//
///////////////////////////////////////////////////////////////////////////////

module vga_ctrl (
  input  wire         clk,
  input  wire         rst_n,
  input  wire         blank,            // Sync these to vs
  input  wire         border_en,        // Sync these to vs
  input  wire  [7:0]  border_color,     // Sync these to vs
  input  wire  [7:0]  border_width,     // Sync these to vs
  input  wire  [7:0]  bg_color,         // Sync these to vs
  output wire  [2:0]  red,
  output wire  [2:0]  green,
  output wire  [1:0]  blue,
  output wire         hs,
  output wire         vs
);

wire [10:0]  x_pixel;
wire [10:0]  y_pixel;

vga_timer #(.HSYNC_PW(11'd112), .HSYNC_BP(11'd248), .COLS(11'd1280),  .HSYNC_FP(11'd48),
            .VSYNC_PW(11'd3),   .VSYNC_BP(11'd38),  .LINES(11'd1024), .VSYNC_FP(11'd1),
				.POLARITY(1'b0) ) i_vga_timer (
  .clk(clk),
  .rst_n(rst_n),
  .v_sync(vs),
  .h_sync(hs),
  .x_pixel(x_pixel[10:0]),
  .y_pixel(y_pixel[10:0])
);

vga_get_colors #(.COLS(11'd1280), .ROWS(11'd1024)) i_vga_get_colors (
  .blank(blank),
  .border_en(border_en),
  .border_color(border_color[7:0]),
  .border_width(border_width[7:0]),
  .bg_color(bg_color[7:0]),
  .x_pixel(x_pixel[10:0]),
  .y_pixel(y_pixel[10:0]),
  .red(red[2:0]),
  .green(green[2:0]),
  .blue(blue[1:0])
);

endmodule
